package com.hxkj.controller.article;

import com.hxkj.domain.po.Article;
import com.hxkj.domain.po.TagsClassify;
import com.hxkj.service.article.TagsClassifyService;
import com.platform.common.dispatcher.util.ResultStructUtils;
import com.platform.common.domain.result.ParameterDataStruct;
import com.platform.common.domain.result.ResultPageStruct;
import com.platform.common.domain.to.PageTo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * @ClassName TagsClassifyController
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/7 11:58
 * @Version 1.0
 */
@RestController
@RequestMapping("/tagsclassify")
public class TagsClassifyController {

    @Autowired
    TagsClassifyService tagsClassifyService;
    /**
     * @Description saveTagsClassify 新增tags标签分类
     **/
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public void saveTagsClassify(@ModelAttribute TagsClassify tagsClassify) throws Exception{
        tagsClassifyService.saveTagsClassify(tagsClassify);
    }

    /**
     * @Description getTagsList 获取tags标签分类列表
     **/
    @RequestMapping(value = "/getlist", method = RequestMethod.POST)
    public Callable<ResultPageStruct<TagsClassify>> getTagsClassifyList(@ModelAttribute TagsClassify tagsClassify, @ModelAttribute PageTo pageParam) throws Exception{
        return () -> tagsClassifyService.getTagsClassifyList(tagsClassify == null ? new TagsClassify() : tagsClassify,pageParam);
    }


    /**
     * @Description removerTags 删除tags标签分类
     **/
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public void removeTagsClassify(@ModelAttribute TagsClassify tagsClassify) throws Exception{
        tagsClassifyService.removeTagsClassify(tagsClassify);
    }

    /**
     * @Description modifyTags 修改tags标签分类
     **/
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    public void modifyTagsClassify(@ModelAttribute TagsClassify tagsClassify) throws Exception{
        tagsClassifyService.modifyTagsClassify(tagsClassify);
    }

    /**
     * @Description getTagsList 获取tags标签分类下拉框
     **/
    @RequestMapping(value = "/getdownlist", method = RequestMethod.POST)
    public Callable<List<TagsClassify>> getTagsClassifyDownList(@ModelAttribute TagsClassify tagsClassify) throws Exception{
        return () -> tagsClassifyService.getTagsClassifyDownList(tagsClassify);
    }

}
